<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js" type="text/javascript"></script>

</head>

<body>

  <div id="app">
    <text-container>
      <template v-slot:header="props">
        <div>头</div>

        <div>{{ props.msg }}</div>

        <div>{{ props.text }}</div>
      </template>

      <template v-slot:footer>
        <div>尾</div>
      </template>
    </text-container>
  </div>

  <script>
    Vue.component('text-container', {
      data: function () {
        return {
          msg: 'Hello isen!!!'
        }
      },
      // slot vue的插槽
      template: '<div>' +
        '<slot name="header" :msg="msg" text="22222"></slot>' +
        '<div>text组件</div>' +
        '<input v-model="msg"/>' +
        '<slot name="footer"></slot>' +
        '</div>'
    })

    let vm = new Vue({
      el: '#app',
      data: {
        msg: ''
      }
    });

  </script>
</body>

</html>
